<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript">
        var num = parseInt(prompt("请输入任意3位数", 999));
        while (true) {
            if (num >= 100 && num <= 999) {
                var ge = num % 10;
                var shi = parseInt((num / 10) % 10)
                var bai = parseInt(num / 100)

                alert("各位数之和为" + ge + shi + bai)
                break;
            } else {
                alert("请输入正确的形式")
                var num = parseInt(prompt("请输入任意3位数", 999));
            }
        }


    </script>
</head>

<body>
</body>

</html>